Skip to content

Fix environment variable substitution in .env files #766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gverkes
Copy link

@gverkes gverkes commented Aug 4, 2025

Fixes #159

Summary

Fixed environment variable substitution in .env files by ensuring system environment variables are available during parsing.

Problem

When using environment variable substitution in .env files (e.g., PATH="${PATH};custom-path"), system environment variables were not available for substitution. Only the launch configuration's env variables were passed to the parser.

Solution

Modified helper.ts to merge process.env with debugLaunchEnvVars before passing to the env file parser. This ensures all system environment variables are available for substitution while still allowing launch config variables to override system ones.

Test plan

  • Added comprehensive unit tests for environment variable substitution
  • Tests verify system env vars are available for substitution
  • Tests verify launch config vars override system vars
  • All existing tests pass
  • Manually tested with a real debugging session

- Merge process.env with debugLaunchEnvVars before parsing .env file
- This ensures system environment variables like PATH are available for substitution
- Add comprehensive unit tests for environment variable substitution
- Fixes issue where ${PATH} and other system vars weren't expanded in .env files
@gverkes
Copy link
Author

gverkes commented Aug 4, 2025

@microsoft-github-policy-service agree company="CuspAI"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Environment variable definitions file substitution does not work when debugging a Python file
1 participant